import storage from '../../../../util/storage'
// 国际化工具类
const mescrollI18n = {
	// 默认语言
	def: "zh",
	// 获取当前语言类型
	getType(){
		const languageList = ['zh', 'en', 'ja', 'pt']
		let language = null
		
		for (let index = 0; index < languageList.length; index++) {
			const key = languageList[index];
			if (new RegExp(key, 'i').test(storage.get('language'))) {
				language = key
			}	
		}

		return language ? language : this.def
	},
	// 设置当前语言类型
	setType(type){
		storage.set("language", type)
	}
}

export default mescrollI18n
